/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.lucava.boatskeeper.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.event.shared.SimpleEventBus;
import org.lucava.boatskeeper.client.control.AuthController;
import org.lucava.boatskeeper.client.control.BoatController;
import org.lucava.boatskeeper.client.control.CategoryController;
import org.lucava.boatskeeper.client.control.LayoutController;
import org.lucava.boatskeeper.client.control.MenuController;
import org.lucava.boatskeeper.client.control.UserController;
import org.lucava.boatskeeper.client.layout.AuthLayout;
import org.lucava.boatskeeper.client.layout.MainLayout;
import org.lucava.lib.client.control.FrontControl;

/**
 * Main entry point.
 *
 * @author glenn
 */
public class MainEntryPoint implements EntryPoint {

    /**
     * Creates a new instance of MainEntryPoint
     */
    public MainEntryPoint() {
    }

    /**
     * The entry point method, called automatically by loading a module that
     * declares an implementing class as an entry-point
     */
    @Override
    public void onModuleLoad() {


        final EventBus eventBus = GWT.create(SimpleEventBus.class);



        FrontControl front = new FrontControl(eventBus);

        AuthController authControl = new AuthController();
        MenuController menuControl = new MenuController();
        BoatController boatControl = new BoatController();
        CategoryController categoryControl = new CategoryController();
        UserController userControl = new UserController();
        LayoutController layoutControl = new LayoutController();

        /*authControl.setViewContainer(layout.getContentPanel());
         layoutControl.setLayout(layout);
         */
        front.addController(authControl);
        front.addController(menuControl);
        front.addController(boatControl);
        front.addController(categoryControl);
        front.addController(userControl);
        //front.addController(layoutControl);

        
        front.getLayoutManager().addLayout("auth", new AuthLayout());
        front.getLayoutManager().addLayout("default", new MainLayout(), true);
        front.setSecure(true);

        /*
         menuControl.setViewContainer(layout.getMenuBar());
         boatControl.setViewContainer(layout.getContentPanel());
         userControl.setViewContainer(layout.getContentPanel());
         categoryControl.setViewContainer(layout.getContentPanel());
         */

        front.run();


    }
}
